import Missile
import pygame

image1=pygame.image.load("javelin.bmp")
image1.set_colorkey((255,0,255))

class Javelin(Missile.Missile):
	def __init__(self,x=0,y=0,mass=3.5,image=image1):
		Missile.Missile.__init__(self,x=x,y=y,mass=mass,image=image)
		self.cur_image=self.image
	def canClimb(self,it):
		return True
	def isAlive(self):
		return True#False
	def getImageThrown(self):
		if not (self.prev_y==self.y and self.prev_x==self.x):
			import math
			r=(self.x-self.prev_x)/(((self.x-self.prev_x)**2+(self.y-self.prev_y)**2)**0.5)
			a=math.acos(r)*180/math.pi
			if self.y-self.prev_y<0:
				a=-a
			self.cur_image=pygame.transform.rotate(self.image,a)
		return (self.x-0.5*self.getWidth(),self.y+self.getHeight()),self.cur_image
	def damageDealt(self,other):
		p=70
		print "baaah",p
		other.physicalDamageTaken(p)
	def hitResult(self):
		pass
		#self.cur_room.projectilesList.remove(self)
	def getHeight(self):
		return self.cur_image.get_height()
	def getWidth(self):
		return self.cur_image.get_width()
	def getFullHeight(self):
		self.getHeight()